using System;

namespace SharePoint.Security.ContentScanner.Engine.Analyzers
{
    public static class DocumentScannerFactory
    {
        public static IDocumentScanner Create(string fileExtension)
        {
            if (string.IsNullOrEmpty(fileExtension))
            {
                return null;
            }

            switch (fileExtension.ToLower())
            {
                case ".docx":
                    return new WordDocumentScanner();                
                case ".aspx":
                    return new ASPXDocumentScanner();
                default:
                    throw new InvalidOperationException(string.Format("File extension {0} is not scannable.", fileExtension));
            }
        }
    }
}